/**
 * 倒计时
 */
var endtimes=new Array();//结束时间                  
var nowtimes;
function givetime(){
	nowtimes=new Date();//当前服务器时间
	window.setTimeout("DownCount()",1000)
}
function DownCount(){
    nowtimes = Number(nowtimes) + 1000;
	for (var i = 0; i < endtimes.length; i++)
	{
		var theDay=new Date(endtimes[i]);
		theDay=theDay++;
		if(theDay<=nowtimes)
		{
			document.getElementById("times"+i).innerHTML = "已结束";
		}
		else{
				timechange(theDay,i);
		}
	}
	window.setTimeout("DownCount()",1000);
}
function timechange(theDay,i){
	var theDays=new Date(theDay);
	var seconds = (theDays - nowtimes)/1000;
	var minutes = Math.floor(seconds/60);
	var hours = Math.floor(minutes/60);
	var days = Math.floor(hours/24);
	var CDay= days;
	var CHour= hours % 24;
	var CMinute= minutes % 60;
	var CSecond= Math.floor(seconds % 60);
	var CHour = CHour + CDay * 24;
	
	if(CMinute<10)
	{
		CMinute="0"+CMinute;
	}
	if(CHour<10)
	{
		CHour="0"+CHour;
	}
	if(CSecond<10)
	{
		CSecond="0"+CSecond;
	}
	document.getElementById("times" + i).innerHTML = CHour + "小时，" + CMinute + "分钟，" + CSecond + "秒" ;
}
function innerendtime(index, endtime) {
    endtimes[index] = endtime;
}

function shownowdate(){
	var day="";
	var month="";
	var ampm="";
	var ampmhour="";
	var myweekday="";
	var year="";
	mydate=new Date();
	myweekday=mydate.getDay();
	mymonth=mydate.getMonth()+1;
	myday= mydate.getDate();
	year= mydate.getFullYear();
	if(myweekday == 0)
	weekday=" 星期日 ";
	else if(myweekday == 1)
	weekday=" 星期一 ";
	else if(myweekday == 2)
	weekday=" 星期二 ";
	else if(myweekday == 3)
	weekday=" 星期三 ";
	else if(myweekday == 4)
	weekday=" 星期四 ";
	else if(myweekday == 5)
	weekday=" 星期五 ";
	else if(myweekday == 6)
	weekday=" 星期六 ";
	document.write(year+"年"+mymonth+"月"+myday+"日 "+weekday);
}